strSQL = "SELECT top " & intMaxRows & " [Time], Username, PrinterName as Printer, DocumentName as Document, pages as PagesPrinted, Cost as TotalCost, Status, ID, Refunded, Cancelled, Denied FROM JobLog WHERE 1 = 1 ##WHERE## ORDER BY ##ORDERBY## [time] desc, username asc"
strSQL = "SELECT top " & intMaxRows & " Username, CLng(SUM(pages)) as PagesPrinted, COUNT(*) as PrintJobs, AVG(pages) as PagesPerJob, SUM(cost) as TotalCost FROM JobLog WHERE 1 = 1 ##WHERE## GROUP BY username ORDER BY ##ORDERBY## username asc"
strSQL = "SELECT top " & intMaxRows & " PrinterName, CLng(SUM(pages)) as PagesPrinted, COUNT(*) as PrintJobs, AVG(pages) as PagesPerJob, SUM(cost) as TotalCost FROM JobLog WHERE 1 = 1 ##WHERE## GROUP BY printername ORDER BY ##ORDERBY## printername asc"
strSQL = "SELECT top " & intMaxRows & " logdate as [Time], Username, totalmb as NetDataUsed, totalnethours as NetTimeUsed, Cost as TotalCost FROM NetChargeLog WHERE 1 = 1 ##WHERE## ORDER BY ##ORDERBY## logdate desc, username asc"
ElseIf strReportType = "summarybyuser" or strReportType = "summarybyprinter" Then
strSQL = "SELECT top " & intMaxRows & " Username, SUM(totalmb) as NetDataUsed, SUM(totalnethours) as NetTimeUsed, SUM(cost) as TotalCost FROM NetChargeLog WHERE 1 = 1 ##WHERE## GROUP BY username ORDER BY ##ORDERBY## username asc"